package com.hyou.demos.chain;

import java.util.HashMap;
import java.util.Map;

import com.hyou.demos.chain.context.DefaultHandlerContext;
import com.hyou.demos.chain.context.HandlerContext;
import com.hyou.demos.chain.handler.Handler;
import com.hyou.demos.chain.handler.impl.OneHandlerImpl;
import com.hyou.demos.chain.handler.impl.ThreeHandlerImpl;
import com.hyou.demos.chain.handler.impl.TwoHandlerImpl;

public class Main {
    
    public static void main(String[] args) {
        
        Handler one = new OneHandlerImpl();
        Handler two = new TwoHandlerImpl();
        Handler three = new ThreeHandlerImpl();
        
        HandlerContext ctx = new DefaultHandlerContext();
        ctx.addLast(one);
        ctx.addLast(two);
        ctx.addLast(three);
        
        Map<String, Object> paramObj = new HashMap<>();
        paramObj.put("one", "String");
        paramObj.put("two", 123);
        paramObj.put("three", true);
        
        ctx.fireInvokeRequest(paramObj);
    }
    
}
